<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------

namespace app\common\model;
use think\Db;
/**
 * 设置模型
 */
class Cate extends Base{
	protected $auto = array('update_time');
	protected $insert = array('create_time');
	protected $type = array(
		'id'   => 'integer',
		'cover_id'   => 'integer',
	);

	public $keyList = array(
		array('name'=>'id', 'title'=>'ID', 'type'=>'hidden', 'help'=>'', 'option'=>''),
		array('name'=>'name', 'title'=>'分类名称', 'type'=>'text', 'help'=>'100个字以内', 'option'=>''),
		array('name'=>'icon', 'title'=>'图标', 'type'=>'image', 'help'=>'', 'option'=>''),
		array('name'=>'sort', 'title'=>'排序', 'type'=>'num', 'help'=>'', 'option'=>''),
	);
           /**
    * 获取分类列表
    */
    public static function getCategoryList($where=[],$order=''){
        return Db::name('category c')
                ->join('xy_picture p','p.id = c.icon')                
                ->where($where)
                ->field('c.*,p.url')->order($order)->paginate();
    } 
}